<!DOCTYPE html>
<html>

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>破解密码</title>
  <link type="text/css" href="css/mystyle.css" rel="stylesheet" />
  <link type="text/css" href="css/mytanchuang.css" rel="stylesheet" />
  <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
  <script src="https://cdn.jsdelivr.net/gh/StephanWagner/jBox@v1.3.3/dist/jBox.all.min.js"></script>
  <link href="https://cdn.jsdelivr.net/gh/StephanWagner/jBox@v1.3.3/dist/jBox.all.min.css" rel="stylesheet">
  <link rel="icon" href="./img/3.png">
</head>

<body>
  <div id="clock">
	<div class="text">密码破译任务倒计时：</div>
	<div id="end" class="end"></div>
  </div>
  <div class="mkuang" id="mtankuang">
  	<div class="mwrapper">
  	        <div class="mverify">
  	            <input type="text" required id="manswer">
  	            <div class="lineunder"></div>
  	            <label>密码由15位小写字母组成，尝试攻击他吧</label>
  	        </div>
  	    </div>
  </div>

  <script>
	  var mypassword="bestwishestofmx"
	  var leftTime=0;
	  var attack = document.getElementById("manswer");
	  attack.oninput=(e)=>{
		  var manswer = attack.value;
		  var length = manswer.length;
		  if(manswer.length!=0){
			  if(manswer.slice(0,manswer.length)==mypassword.slice(0,manswer.length))
			     {
					 if(manswer.length==mypassword.length){
						  new jBox('Notice', {content: `密码破解成功!`, color: 'green'});
						  if(leftTime>0){
						   setTimeout(()=>{
								  location.href="http://ygxy-hy.gitee.io/primary-message/";
							  },1000)
							}else{
							 setTimeout(()=>{
								  location.href="meteor.html";
							},1000)}
					 }else{
						 new jBox('Notice', {content: `运行时间${manswer.length*2}ms`, color: 'blue'});			 
					 }
				}
			  else{
				 new jBox('Notice', {content: `运行时间${(manswer.length-1)*2}ms`, color: 'red'});
				  attack.value=mypassword.slice(0,manswer.length-1)
				  }
			  }  
		  }
    var timerID = setInterval(updateTime, 1000); // 每隔1秒执行一次
    updateTime();

    function updateTime() {
      var cd = new Date();
	  document.getElementById("end").innerHTML=countTime(cd);
    };
	
	function countTime(date) {  
	             //获取当前时间  
	               
	             var now = date.getTime();  
	             //设置截止时间  
	             var str="2022/12/24 00:00:00";
	             var endDate = new Date(str); 
	             var end = endDate.getTime();  
	            
	            //时间差  
	            leftTime = end-now; 
	             //定义变量 d,h,m,s保存倒计时的时间  
				 if(leftTime<0){
				 document.getElementById("clock").remove();
				 clearInterval(timerID);
				 }
	             var d,h,m,s;  
	            if (leftTime>=0) {  
	                 d = Math.floor(leftTime/1000/60/60/24);  
	                 h = Math.floor(leftTime/1000/60/60%24);  
	                 m = Math.floor(leftTime/1000/60%60);  
	                 s = Math.floor(leftTime/1000%60);                     
	             }  
				return (d+"天"+h+"时"+m+"分"+s+"秒");
	         }  

  </script>

</body>

</html>